﻿@page "/"
@using SPA.Data

<div class="layui-container">
<div class="layui-row layui-col-space15">
<div class="layui-col-md8">
<div class="fly-panel">
  <div class="fly-panel-title fly-filter">
    <a>所有帖子</a>
  </div>
  <ul class="fly-list">
    @foreach (var thread in threads)
    {
      <li>
        <a href="#" class="fly-avatar">
              <img src="https://tva1.sinaimg.cn/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg" alt="贤心">
        </a>
        <h2>
          <NavLink class="nav-link" href="@($"detail/{thread.Id}")">
            @(thread.Title)
          </NavLink>
        </h2>
        <div class="fly-list-info">
          <a href="#" link>
            <cite>@(thread.Author)</cite>
            <i class="layui-badge fly-badge-vip">VIP</i>
          </a>
          <span>@(thread.AddTime.ToString("yyyy-MM-dd HH:mm"))</span>
          <span class="fly-list-nums"> 
            <i class="iconfont icon-pinglun1" title="回答"></i> @(thread.Comment)
          </span>
        </div>
      </li>
    }
  </ul>
</div>
@*
<div class="fly-panel" style="margin-bottom: 0;">
        
<div class="fly-panel-title fly-filter">
  <a href="" class="layui-this">综合</a>
  <span class="fly-mid"></span>
  <a href="">未结</a>
  <span class="fly-mid"></span>
  <a href="">已结</a>
  <span class="fly-mid"></span>
  <a href="">精华</a>
  <span class="fly-filter-right layui-hide-xs">
    <a href="" class="layui-this">按最新</a>
    <span class="fly-mid"></span>
    <a href="">按热议</a>
  </span>
</div>

<ul class="fly-list">          
<li>
  <a href="user/home.html" class="fly-avatar">
    <img src="https://tva1.sinaimg.cn/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg" alt="贤心">
  </a>
  <h2>
    <a class="layui-badge">分享</a>
    <a href="jie/detail.html">基于 layui 的极简社区页面模版</a>
  </h2>
  <div class="fly-list-info">
    <a href="user/home.html" link>
      <cite>贤心</cite>
      <!--
      <i class="iconfont icon-renzheng" title="认证信息：XXX"></i>
      <i class="layui-badge fly-badge-vip">VIP3</i>
      -->
    </a>
    <span>刚刚</span>
              
    <span class="fly-list-kiss layui-hide-xs" title="悬赏飞吻"><i class="iconfont icon-kiss"></i> 60</span>
    <!--<span class="layui-badge fly-badge-accept layui-hide-xs">已结</span>-->
    <span class="fly-list-nums"> 
      <i class="iconfont icon-pinglun1" title="回答"></i> 66
    </span>
  </div>
  <div class="fly-list-badge">
    <!--<span class="layui-badge layui-bg-red">精帖</span>-->
  </div>
</li>
<li>
  <a href="user/home.html" class="fly-avatar">
    <img src="https://tva1.sinaimg.cn/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg" alt="贤心">
  </a>
  <h2>
    <a class="layui-badge">动态</a>
    <a href="jie/detail.html">基于 layui 的极简社区页面模版</a>
  </h2>
  <div class="fly-list-info">
    <a href="user/home.html" link>
      <cite>贤心</cite>
      <!--<i class="iconfont icon-renzheng" title="认证信息：XXX"></i>-->
      <i class="layui-badge fly-badge-vip">VIP3</i>
    </a>
    <span>刚刚</span>
              
    <span class="fly-list-kiss layui-hide-xs" title="悬赏飞吻"><i class="iconfont icon-kiss"></i> 60</span>
    <span class="layui-badge fly-badge-accept layui-hide-xs">已结</span>
    <span class="fly-list-nums"> 
      <i class="iconfont icon-pinglun1" title="回答"></i> 66
    </span>
  </div>
  <div class="fly-list-badge">
    <span class="layui-badge layui-bg-red">精帖</span>
  </div>
</li>
<li>
  <a href="user/home.html" class="fly-avatar">
    <img src="https://tva1.sinaimg.cn/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg" alt="贤心">
  </a>
  <h2>
    <a class="layui-badge">动态</a>
    <a href="jie/detail.html">基于 layui 的极简社区页面模版</a>
  </h2>
  <div class="fly-list-info">
    <a href="user/home.html" link>
      <cite>贤心</cite>
      <!--
      <i class="iconfont icon-renzheng" title="认证信息：XXX"></i>
      <i class="layui-badge fly-badge-vip">VIP3</i>
      -->
    </a>
    <span>刚刚</span>
              
    <span class="fly-list-kiss layui-hide-xs" title="悬赏飞吻"><i class="iconfont icon-kiss"></i> 60</span>
    <!--<span class="layui-badge fly-badge-accept layui-hide-xs">已结</span>-->
    <span class="fly-list-nums"> 
      <i class="iconfont icon-pinglun1" title="回答"></i> 66
    </span>
  </div>
  <div class="fly-list-badge">
    <!--<span class="layui-badge layui-bg-red">精帖</span>-->
  </div>
</li>
<li>
  <a href="user/home.html" class="fly-avatar">
    <img src="https://tva1.sinaimg.cn/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg" alt="贤心">
  </a>
  <h2>
    <a class="layui-badge">动态</a>
    <a href="jie/detail.html">基于 layui 的极简社区页面模版</a>
  </h2>
  <div class="fly-list-info">
    <a href="user/home.html" link>
      <cite>贤心</cite>
      <!--
      <i class="iconfont icon-renzheng" title="认证信息：XXX"></i>
      <i class="layui-badge fly-badge-vip">VIP3</i>
      -->
    </a>
    <span>刚刚</span>
              
    <span class="fly-list-kiss layui-hide-xs" title="悬赏飞吻"><i class="iconfont icon-kiss"></i> 60</span>
    <!--<span class="layui-badge fly-badge-accept layui-hide-xs">已结</span>-->
    <span class="fly-list-nums"> 
      <i class="iconfont icon-pinglun1" title="回答"></i> 66
    </span>
  </div>
  <div class="fly-list-badge">
    <!--<span class="layui-badge layui-bg-red">精帖</span>-->
  </div>
</li>
<li>
  <a href="user/home.html" class="fly-avatar">
    <img src="https://tva1.sinaimg.cn/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg" alt="贤心">
  </a>
  <h2>
    <a class="layui-badge">动态</a>
    <a href="jie/detail.html">基于 layui 的极简社区页面模版</a>
  </h2>
  <div class="fly-list-info">
    <a href="user/home.html" link>
      <cite>贤心</cite>
      <!--
      <i class="iconfont icon-renzheng" title="认证信息：XXX"></i>
      <i class="layui-badge fly-badge-vip">VIP3</i>
      -->
    </a>
    <span>刚刚</span>
              
    <span class="fly-list-kiss layui-hide-xs" title="悬赏飞吻"><i class="iconfont icon-kiss"></i> 60</span>
    <!--<span class="layui-badge fly-badge-accept layui-hide-xs">已结</span>-->
    <span class="fly-list-nums"> 
      <i class="iconfont icon-pinglun1" title="回答"></i> 66
    </span>
  </div>
  <div class="fly-list-badge">
    <!--<span class="layui-badge layui-bg-red">精帖</span>-->
  </div>
</li>
<li>
  <a href="user/home.html" class="fly-avatar">
    <img src="https://tva1.sinaimg.cn/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg" alt="贤心">
  </a>
  <h2>
    <a class="layui-badge">动态</a>
    <a href="jie/detail.html">基于 layui 的极简社区页面模版</a>
  </h2>
  <div class="fly-list-info">
    <a href="user/home.html" link>
      <cite>贤心</cite>
      <!--
      <i class="iconfont icon-renzheng" title="认证信息：XXX"></i>
      <i class="layui-badge fly-badge-vip">VIP3</i>
      -->
    </a>
    <span>刚刚</span>
              
    <span class="fly-list-kiss layui-hide-xs" title="悬赏飞吻"><i class="iconfont icon-kiss"></i> 60</span>
    <!--<span class="layui-badge fly-badge-accept layui-hide-xs">已结</span>-->
    <span class="fly-list-nums"> 
      <i class="iconfont icon-pinglun1" title="回答"></i> 66
    </span>
  </div>
  <div class="fly-list-badge">
    <!--<span class="layui-badge layui-bg-red">精帖</span>-->
  </div>
</li>
<li>
  <a href="user/home.html" class="fly-avatar">
    <img src="https://tva1.sinaimg.cn/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg" alt="贤心">
  </a>
  <h2>
    <a class="layui-badge">动态</a>
    <a href="jie/detail.html">基于 layui 的极简社区页面模版</a>
  </h2>
  <div class="fly-list-info">
    <a href="user/home.html" link>
      <cite>贤心</cite>
      <!--
      <i class="iconfont icon-renzheng" title="认证信息：XXX"></i>
      <i class="layui-badge fly-badge-vip">VIP3</i>
      -->
    </a>
    <span>刚刚</span>
              
    <span class="fly-list-kiss layui-hide-xs" title="悬赏飞吻"><i class="iconfont icon-kiss"></i> 60</span>
    <!--<span class="layui-badge fly-badge-accept layui-hide-xs">已结</span>-->
    <span class="fly-list-nums"> 
      <i class="iconfont icon-pinglun1" title="回答"></i> 66
    </span>
  </div>
  <div class="fly-list-badge">
    <!--<span class="layui-badge layui-bg-red">精帖</span>-->
  </div>
</li>
<li>
  <a href="user/home.html" class="fly-avatar">
    <img src="https://tva1.sinaimg.cn/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg" alt="贤心">
  </a>
  <h2>
    <a class="layui-badge">动态</a>
    <a href="jie/detail.html">基于 layui 的极简社区页面模版</a>
  </h2>
  <div class="fly-list-info">
    <a href="user/home.html" link>
      <cite>贤心</cite>
      <!--
      <i class="iconfont icon-renzheng" title="认证信息：XXX"></i>
      <i class="layui-badge fly-badge-vip">VIP3</i>
      -->
    </a>
    <span>刚刚</span>
              
    <span class="fly-list-kiss layui-hide-xs" title="悬赏飞吻"><i class="iconfont icon-kiss"></i> 60</span>
    <!--<span class="layui-badge fly-badge-accept layui-hide-xs">已结</span>-->
    <span class="fly-list-nums"> 
      <i class="iconfont icon-pinglun1" title="回答"></i> 66
    </span>
  </div>
  <div class="fly-list-badge">
    <!--<span class="layui-badge layui-bg-red">精帖</span>-->
  </div>
</li>
<li>
  <a href="user/home.html" class="fly-avatar">
    <img src="https://tva1.sinaimg.cn/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg" alt="贤心">
  </a>
  <h2>
    <a class="layui-badge">动态</a>
    <a href="jie/detail.html">基于 layui 的极简社区页面模版</a>
  </h2>
  <div class="fly-list-info">
    <a href="user/home.html" link>
      <cite>贤心</cite>
      <!--
      <i class="iconfont icon-renzheng" title="认证信息：XXX"></i>
      <i class="layui-badge fly-badge-vip">VIP3</i>
      -->
    </a>
    <span>刚刚</span>
              
    <span class="fly-list-kiss layui-hide-xs" title="悬赏飞吻"><i class="iconfont icon-kiss"></i> 60</span>
    <!--<span class="layui-badge fly-badge-accept layui-hide-xs">已结</span>-->
    <span class="fly-list-nums"> 
      <i class="iconfont icon-pinglun1" title="回答"></i> 66
    </span>
  </div>
  <div class="fly-list-badge">
    <!--<span class="layui-badge layui-bg-red">精帖</span>-->
  </div>
</li>
<li>
  <a href="user/home.html" class="fly-avatar">
    <img src="https://tva1.sinaimg.cn/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg" alt="贤心">
  </a>
  <h2>
    <a class="layui-badge">动态</a>
    <a href="jie/detail.html">基于 layui 的极简社区页面模版</a>
  </h2>
  <div class="fly-list-info">
    <a href="user/home.html" link>
      <cite>贤心</cite>
      <!--
      <i class="iconfont icon-renzheng" title="认证信息：XXX"></i>
      <i class="layui-badge fly-badge-vip">VIP3</i>
      -->
    </a>
    <span>刚刚</span>
              
    <span class="fly-list-kiss layui-hide-xs" title="悬赏飞吻"><i class="iconfont icon-kiss"></i> 60</span>
    <!--<span class="layui-badge fly-badge-accept layui-hide-xs">已结</span>-->
    <span class="fly-list-nums"> 
      <i class="iconfont icon-pinglun1" title="回答"></i> 66
    </span>
  </div>
  <div class="fly-list-badge">
    <!--<span class="layui-badge layui-bg-red">精帖</span>-->
  </div>
</li>
<li>
  <a href="user/home.html" class="fly-avatar">
    <img src="https://tva1.sinaimg.cn/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg" alt="贤心">
  </a>
  <h2>
    <a class="layui-badge">动态</a>
    <a href="jie/detail.html">基于 layui 的极简社区页面模版</a>
  </h2>
  <div class="fly-list-info">
    <a href="user/home.html" link>
      <cite>贤心</cite>
      <!--
      <i class="iconfont icon-renzheng" title="认证信息：XXX"></i>
      <i class="layui-badge fly-badge-vip">VIP3</i>
      -->
    </a>
    <span>刚刚</span>
              
    <span class="fly-list-kiss layui-hide-xs" title="悬赏飞吻"><i class="iconfont icon-kiss"></i> 60</span>
    <!--<span class="layui-badge fly-badge-accept layui-hide-xs">已结</span>-->
    <span class="fly-list-nums"> 
      <i class="iconfont icon-pinglun1" title="回答"></i> 66
    </span>
  </div>
  <div class="fly-list-badge">
    <!--<span class="layui-badge layui-bg-red">精帖</span>-->
  </div>
</li>
<li>
  <a href="user/home.html" class="fly-avatar">
    <img src="https://tva1.sinaimg.cn/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg" alt="贤心">
  </a>
  <h2>
    <a class="layui-badge">动态</a>
    <a href="jie/detail.html">基于 layui 的极简社区页面模版</a>
  </h2>
  <div class="fly-list-info">
    <a href="user/home.html" link>
      <cite>贤心</cite>
      <!--
      <i class="iconfont icon-renzheng" title="认证信息：XXX"></i>
      <i class="layui-badge fly-badge-vip">VIP3</i>
      -->
    </a>
    <span>刚刚</span>
              
    <span class="fly-list-kiss layui-hide-xs" title="悬赏飞吻"><i class="iconfont icon-kiss"></i> 60</span>
    <!--<span class="layui-badge fly-badge-accept layui-hide-xs">已结</span>-->
    <span class="fly-list-nums"> 
      <i class="iconfont icon-pinglun1" title="回答"></i> 66
    </span>
  </div>
  <div class="fly-list-badge">
    <!--<span class="layui-badge layui-bg-red">精帖</span>-->
  </div>
</li>
</ul>
<div style="text-align: center">
  <div class="laypage-main">
    <a href="jie/index.html" class="laypage-next">更多求解</a>
  </div>
</div>

</div>
*@
</div>
<div class="layui-col-md4">
<div class="fly-panel fly-signin">
    <div class="fly-panel-title">
      签到
      <i class="fly-mid"></i> 
      <a href="javascript:;" class="fly-link" id="LAY_signinHelp">说明</a>
      <span class="fly-signin-days">已连续签到<cite>@signDays</cite>天</span>
    </div>
    <div class="fly-panel-main fly-signin-main">
      <button class="layui-btn layui-btn-danger" id="LAY_signin" @onclick="Sign">今日签到</button>
      <span>可获得<cite>5</cite>飞吻</span>
          
      <!-- 已签到状态 -->
      <!--
      <button class="layui-btn layui-btn-disabled">今日已签到</button>
      <span>获得了<cite>20</cite>飞吻</span>
      -->
    </div>
  </div>
  <div class="fly-panel">
    <div class="fly-panel-main">
      <a href="http://layim.layui.com/?from=fly" target="_blank" class="fly-zanzhu" time-limit="2017.09.25-2099.01.01" style="background-color: #5FB878;">
广告
</a>
    </div>
  </div>
      


</div>
</div>
</div>

@code{

  private int signDays = 10;

  Thread[] threads;
  
  protected override async Task OnInitializedAsync()
  {
    using (var db = new DbClient())
    {
      threads = (await db.Queryable<Thread>().Select(it=>new Thread
      {
        Id = it.Id,
        Title = it.Title,
        Author = it.Author,
        AddTime = it.AddTime,
        Comment = it.Comment
      }).OrderBy("id DESC").Take(50).ToListAsync()).ToArray();
    }
  }
  
  void Sign()
  {
    signDays++;
  }

}
